package com.cosc.apgs.param.controller;

import com.cosc.apgs.param.entity.CoscSystemSelect;
import com.cosc.apgs.param.entity.CoscTradeCodeInfo;
import com.cosc.apgs.param.service.CommonService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author Howl-Xu
 * @version 1.0.0
 * @Description: 公共控制器
 * @createTime 2020年11月18日 10:27:00
 */

@Controller
@RequestMapping("/api/commonController/")
@Api(value = "CommonController")
public class CommonController {

    @Autowired
    private CommonService commonService;

    @GetMapping("/getSystemList")
    @ApiOperation(value = "获取系统列表", tags = {"获取系统列表"}, notes = "获取系统列表")
    @ResponseBody
    public List<CoscSystemSelect> getSystemList() {
        return commonService.getSystemList();
    }

    @GetMapping("/getTradeCodeList")
    @ApiOperation(value = "获取交易码表", tags = {"获取交易码表"}, notes = "获取交易码表")
    @ResponseBody
    public List<CoscTradeCodeInfo> getTradeCodeList(String systemIndex) {
        return commonService.getTradeCodeList(systemIndex);
    }

    @GetMapping("/getTradeCodeInfoList")
    @ApiOperation(value = "获取交易码表详情表", tags = {"获取交易码表详情表"}, notes = "获取交易码表详情表")
    @ResponseBody
    public List<CoscTradeCodeInfo> getTradeCodeInfoList(String systemIndex) {
        return commonService.getTradeCodeInfoList(systemIndex);
    }


    @GetMapping("/getTradeCodeInfo")
    @ApiOperation(value = "获取交易对应的URL以及请求报文", tags = {"获取交易对应的URL以及请求报文"}, notes = "获取交易对应的URL以及请求报文")
    @ResponseBody
    public CoscTradeCodeInfo getTradeCodeInfo(String systemIndex, String tradeCodeIndex) {
        return commonService.getTradeCodeInfo(systemIndex, tradeCodeIndex);
    }



}
